<?php

namespace app\admin\validate;

use think\Validate;

class GroupValidate extends Validate
{
    protected $rule = [
        'id' => 'require|integer',
        'title' => 'require|max:50',
        'description' => 'max:255',
        'qrcode' => 'require|max:255',
        'status' => 'require|in:enable,disable',
    ];

    protected $message = [
        'id.require' => 'ID不能为空',
        'id.integer' => 'ID必须是数字',
        'description.max' => '描述不能超过255个字符',
        'qrcode.require' => '二维码不能为空',
        'qrcode.max' => '二维码不能超过255个字符',
        'status.require' => '状态不能为空',
        'status.in' => '状态必须是可用或禁用',
    ];
    protected $scene = [
        'create' => ['title', 'description', 'qrcode', 'status', 'id'],
        'update' => ['title', 'description', 'qrcode', 'status', 'id'],
    ];
}